package com.tm.chargecar.controller;

import com.baomidou.mybatisplus.extension.api.R;
import com.tm.chargecar.entity.DogcartRepairEntity;
import com.tm.chargecar.result.Result;
import com.tm.chargecar.service.DogcartRepairService;
import com.tm.chargecar.utils.PageUtil;
import com.tm.chargecar.vo.DogcartRepairVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author wangSang
 * @create 2022-08-24 9:50
 *
 * 设备管理-保修记录  controller层
 */
@RestController
@RequestMapping("dogcartRepair")
public class DogcartRepairController {

    @Autowired
    private DogcartRepairService dogcartRepairService;

    /**
     *  设备管理-保修记录 查询
     * @param dogcartRepairVo
     * @return
     */
    @GetMapping("queryDogcartRepair")
    public Result queryDogcartRepair(DogcartRepairVo dogcartRepairVo){
      // 条件查询方法
     PageUtil    dogcartRepairPageUtil =   dogcartRepairService.queryDogcartRepair(dogcartRepairVo);


        return Result.SUCCESS(dogcartRepairPageUtil);
    }

    /**
     * 修改设备故障
     * @param dogcartRepairEntity
     * @return
     */
    @PutMapping("updateDogcartRepair")
    public Result updateDogcartRepair(@RequestBody DogcartRepairEntity dogcartRepairEntity){


        return dogcartRepairService.updateDogcartRepair(dogcartRepairEntity);

    }

    /**
     * 删除设备故障
     * @param id
     * @return
     */
    @DeleteMapping("deleteDogcartRepair/{id}")
    public Result deleteDogcartRepair(@PathVariable Integer id){



        return dogcartRepairService.deleteDogcartRepair(id);

    }

    /**
     * 新增设备
     * @param dogcartRepairEntity
     * @return
     */
    @PostMapping("addDogcartRepair")
    public Result addDogcartRepair(@RequestBody DogcartRepairEntity dogcartRepairEntity){

        return dogcartRepairService.addDogcartRepair(dogcartRepairEntity);
    }


}
